home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / srvr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  2.2 KB  |  60 lines

  1. //---------------------------------------------------------------------------
  2. // Borland C++Builder
  3. // Copyright (c) 1987, 1998 Borland International Inc.  All Rights Reserved.
  4. //---------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8. #include "auto2.h"
  9. USERES("srvr.res");
  10. USEFORM("auto1.cpp", Form1);
  11. USETLB("srvr.tlb");
  12. USEUNIT("srvr_TLB.cpp");
  13. USEUNIT("auto2.cpp"); /* EditServer: CoClass */
  14. USEUNIT("srvr_ATL.cpp");
  15. //---------------------------------------------------------------------------
  16. void __fastcall InitAtlServer(void);
  17.  
  18. // NOTE: You may derive a class from TComModule and use it as your server's
  19. //       module object. (i.e. Assign an instance of that class to _Module).
  20. //       However, you must *NOT* change the name _Module.
  21. //
  22. TComModule _ProjectModule(InitAtlServer);
  23. TComModule &_Module = _ProjectModule;
  24.  
  25. // The ATL Object map holds an array of _ATL_OBJMAP_ENTRY structures that
  26. // described the objects of your OLE server. The MAP is handed to your
  27. // project's CComModule-derived _Module object via the Init method.
  28. //
  29. BEGIN_OBJECT_MAP(ObjectMap)
  30.   OBJECT_ENTRY(CLSID_EditServer, TEditServerImpl)
  31. END_OBJECT_MAP()
  32. //---------------------------------------------------------------------------
  33. WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  34. {
  35.         try
  36.         {
  37.                  Application->Initialize();
  38.                  Application->CreateForm(__classid(TForm1), &Form1);
  39.                  Application->Run();
  40.         }
  41.         catch (Exception &exception)
  42.         {
  43.                  Application->ShowException(&exception);
  44.         }
  45.         return 0;
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall InitAtlServer(void)
  49. {
  50.   if (SaveInitProc)
  51.     reinterpret_cast<TProcedure>(SaveInitProc)();
  52.   _Module.Init(ObjectMap, (HINSTANCE)HInstance);
  53.   _Module.m_ThreadID = GetCurrentThreadId();
  54.   _Module.m_bAutomationServer = true;
  55.   _Module.DoFileAndObjectRegistration();
  56.   AddTerminateProc(AutomationTerminateProc);
  57. }
  58.  
  59. //---------------------------------------------------------------------------
  60.